// 系统管理
import request from "@/plugins/request";

// 根据父ID查询字典
export function getDictByParentId(data) {
  return request({
    url: "/platform/sys/dict/getDictByParentId",
    method: "post",
    data,
  });
}

// 根据父ID查询返回树结构
export function getDictTreeByParentId(data) {
  return request({
    url: "/platform/sys/dict/getDictTreeByParentId",
    method: "post",
    data,
  });
}
// 修改字典
export function updateDict(data) {
  return request({
    url: "/platform/sys/dict/updateDict",
    method: "post",
    data,
  });
}
// 添加字典
export function addDict(data) {
  return request({
    url: "/platform/sys/dict/addDict",
    method: "post",
    data,
  });
}

// 获取短信模板分页
export function smsTemplateGetPage(data) {
  return request({
    url: "/platform/smsTemplate/getPage",
    method: "post",
    data,
  });
}
// 添加短信模板
export function smsTemplateAddData(data) {
  return request({
    url: "/platform/smsTemplate/addData",
    method: "post",
    data,
  });
}
// 编辑短信模板
export function smsTemplateEditData(data) {
  return request({
    url: "/platform/smsTemplate/editData",
    method: "post",
    data,
  });
}
// 删除短信模板
export function smsTemplateDelData(data) {
  return request({
    url: "/platform/smsTemplate/delData",
    method: "post",
    data,
  });
}
// 获取预警时间设置分页
export function busForewarningSetGetPage(data) {
  return request({
    url: "/platform/busForewarningSet/getPage",
    method: "post",
    data,
  });
}
// 预警时间设置添加数据
export function busForewarningSetAddData(data) {
  return request({
    url: "/platform/busForewarningSet/addData",
    method: "post",
    data,
  });
}
// 预警时间设置编辑
export function busForewarningSetEditData(data) {
  return request({
    url: "/platform/busForewarningSet/editData",
    method: "post",
    data,
  });
}
// 预警时间设置删除
export function busForewarningSetDelData(data) {
  return request({
    url: "/platform/busForewarningSet/delData",
    method: "post",
    data,
  });
}

// 添加菜单
export function addMenu(data) {
  return request({
    url: "/platform/permission/menu/add",
    method: "post",
    data,
  });
}

// 修改菜单
export function updateMenu(data) {
  return request({
    url: "/platform/permission/menu/update",
    method: "post",
    data,
  });
}

// 菜单详情
export function detailMenu(data) {
  return request({
    url: "/platform/permission/menu/detail",
    method: "post",
    data,
  });
}

// 菜单删除
export function delMenu(data) {
  return request({
    url: "/platform/permission/menu/delByMenuId",
    method: "post",
    data,
  });
}

//获取菜单列表
export function getMenuTree(data = {}) {
  return request({
    url: "/platform/permission/menu/getTree",
    method: "post",
    data,
  });
}

// 绑定权限菜单
export function bindAuthMenu(data = {}) {
  return request({
    url: "/platform/permission/authority/bindAuthMenu",
    method: "post",
    data,
  });
}


// 移动菜单
export function moveMenu(data) {
  return request({
    url: "/platform/permission/menu/move",
    method: "post",
    data,
  });
}

// 获取角色组列表
export function getRoleList(data) {
  return request({
    url: "/platform/permission/role/list",
    method: "post",
    data,
  });
}

// 添加权限
export function addAuthority(data) {
  return request({
    url: "/platform/permission/authority/add",
    method: "post",
    data,
  });
}

// 编辑权限
export function updateAuthority(data) {
  return request({
    url: "/platform/permission/authority/update",
    method: "post",
    data,
  });
}

// 权限管理接口
// 组添加
export function createGroup(data) {
  return request({
    url: "/platform/permission/group/add",
    method: "post",
    data,
  });
}

// 组编辑
export function updateGroup(data) {
  return request({
    url: "/platform/permission/group/edit",
    method: "post",
    data,
  });
}

// 组删除
export function detaleGroup(data) {
  return request({
    url: "/platform/permission/group/del",
    method: "post",
    data,
  });
}

// 组详情
export function getGoupDetail(data) {
  return request({
    url: "/platform/permission/group/detail",
    method: "post",
    data,
  });
}

// 获取角色分组分页
export function getGoupList(data) {
  return request({
    url: "/platform/permission/group/list",
    method: "post",
    data,
  });
}

// 创建角色
export function addRole(data) {
  return request({
    url: "/platform/permission/role/add",
    method: "post",
    data,
  });
}

// 更新角色
export function updateRole(data) {
  return request({
    url: "/platform/permission/role/update",
    method: "post",
    data,
  });
}

// 删除角色
export function deleteRole(data) {
  return request({
    url: "/platform/permission/role/delByRoleId",
    method: "post",
    data,
  });
}

// 公司组织架构
// 获取公司与子公司的分级
export function getOrgTree(data) {
  return request({
    url: "/platform/sys/org/getOrgTree",
    method: "post",
    data,
  });
}

// 获取公司与子公司list
export function getOrgList(data) {
  return request({
    url: "/platform/sys/org/getOrgList",
    method: "post",
    data,
  });
}

// 创建公司
export function addCompany(data) {
  return request({
    url: "/platform/sys/org/company/add",
    method: "post",
    data,
  });
}

// 编辑公司
export function updateCompany(data) {
  return request({
    url: "/platform/sys/org/company/update",
    method: "post",
    data,
  });
}

// 冻结公司
export function freezeCompany(data) {
  return request({
    url: "/platform/sys/org/company/freeze",
    method: "post",
    data,
  });
}

// 解冻公司
export function unFreezeCompany(data) {
  return request({
    url: "/platform/sys/org/company/unFreeze",
    method: "post",
    data,
  });
}

// 设置公司管理员
export function setCompanyAdmin(data) {
  return request({
    url: "/platform/sys/org/company/setCompanyAdmin",
    method: "post",
    data,
  });
}

// 根据公司部门获取部门下所有用户
export function getDepartmentAllUserList(data) {
  return request({
    url: "/platform/sys/org/department/getDepartmentAllUserList",
    method: "post",
    data,
  });
}

// 创建部门
export function addDepartment(data) {
  return request({
    url: "/platform/sys/org/department/add",
    method: "post",
    data,
  });
}

// 修改部门
export function updateDepartment(data) {
  return request({
    url: "/platform/sys/org/department/update",
    method: "post",
    data,
  });
}

// 删除部门
export function deleteDepartment(data) {
  return request({
    url: "/platform/sys/org/department/del",
    method: "post",
    data,
  });
}

// 获取部门绑定的角色
export function getBindAuthList(data) {
  return request({
    url: "/platform/sys/org/department/getBindAuthList",
    method: "post",
    data,
  });
}

// 绑定部门和权限
export function bindDepartmentAuth(data) {
  return request({
    url: "/platform/sys/org/department/bindDepartmentAuth",
    method: "post",
    data,
  });
}

// 获取权限
export function authorityList(data) {
  return request({
    url: "/platform/permission/authority/list",
    method: "post",
    data,
  });
}

// 权限绑定菜单
export function bindMenuAuth(data) {
  return request({
    url: "/platform/permission/menu/bindMenuAuth",
    method: "post",
    data,
  });
}

// 编辑权限
// export function updateAuthority(data) {
//   return request({
//     url: "/platform/permission/authority/list",
//     method: "post",
//     data,
//   });
// }

// 角色绑定权限
export function bindRoleAuth(data) {
  return request({
    url: "/platform/permission/role/bindRoleAuth",
    method: "post",
    data,
  });
}


// 删除权限
export function delByAuthId(data) {
  return request({
    url: "/platform/permission/authority/delByAuthId",
    method: "post",
    data,
  });
}

// 设置用户为部门负责人
export function setUserIsPrincipal(data) {
  return request({
    url: "/platform/sys/org/department/setUserIsPrincipal",
    method: "post",
    data,
  });
}

// 查询用户
export function getOrgAllUserPage(data) {
  return request({
    url: "/platform/sys/org/getOrgAllUserPage",
    method: "post",
    data,
  });
}

// 获取绑定菜单的权限
export function getBindAuthMenuDetail(data) {
  return request({
    url: "/platform/permission/authority/getBindAuthMenuDetail",
    method: "post",
    data,
  });
}

// 获取绑定的权限
export function getBindAuthIdDetail(data) {
  return request({
    url: "/platform/permission/role/getBindAuthIdDetail",
    method: "post",
    data,
  });
}

// 用户绑定角色
export function bindUserRole(data) {
  return request({
    url: "/platform/permission/menu/bindUserRole",
    method: "post",
    data,
  });
}

// 根据组织机构id获取所有用户
export function getOrgAllUserAndStatisticsPage(data) {
  return request({
    url: "/platform/sys/org/getOrgAllUserAndStatisticsPage",
    method: "post",
    data,
  });
}

// 重置密码
export function resetUserPwd(data) {
  return request({
    url: "/platform/sys/org/user/resetUserPwd",
    method: "post",
    data,
  });
}

// 重置密码
export function setUserAccount(data) {
  return request({
    url: "/platform/sys/org/user/setUserAccount",
    method: "post",
    data,
  });
}
